This section covers the basic/simple operations that an application would need to perform on an RFID Reader which includes Inventory and single tag access operations.
A simple continuous inventory operation would read all tags in the field of view of all antennas of the connected RFID Reader. It will use NO filters (pre-filters or post-filters) and the start and stop trigger for the inventory would be default, i.e. start immediately when reader.Actions.Inventory.perform is called, and stop immediately when reader.Actions.Inventory.stop is called.
// perform simple inventory
reader.Actions.Inventory.perform();
// Keep getting tags in the eventReadNotify event if registered
// stop the inventory
reader.Actions.Inventory.stop();
Tag Access operations can be performed on a specific tag or can be applied on tags that match a specific Access-Filter. If no Access-filter is specified the Access Operation will be performed on all Tags in the field of view of chosen Antennas.
This section covers simple tag access operation on a specific tag which could be in the field of view of any of the antenna of the connected RFID Reader.
The application can call method reader.Actions.TagAccess.readWait to read data from a specific memory bank.
// Read user memory bank for the given tag ID
String
tagId = "1234ABCD00000000000025B1";
TagAccess
tagAccess = new TagAccess();
TagAccess.ReadAccessParams
readAccessParams = tagAccess.new ReadAccessParams();
TagData
readAccessTag;
readAccessParams.setAccessPassword(0);
readAccessParams.setByteCount(8);
readAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
readAccessParams.setByteOffset(0);
readAccessTag
= reader.Actions.TagAccess.readWait(tagId, readAccessParams, null);
System.out.println(readAccessTag.getMemoryBank().toString()
+ " : " + readAccessTag.getMemoryBankData());
The application can call method reader.Actions.TagAccess.writeWait or reader.Actions.TagAccess.blockWriteWait to write data to a specific memory bank.
// Write user memory bank data
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.WriteAccessParams writeAccessParams = tagAccess.new WriteAccessParams();
byte[] writeData = new byte[] {0x11, 0x22, 0x33, 0x44};
writeAccessParams.setAccessPassword(0);
writeAccessParams.setWriteDataLength(writeData.Length);
writeAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
writeAccessParams.setByteOffset(0);
writeAccessParams.setWriteData(writeData);
// antenna Info is null performs on all antenna
reader.Actions.TagAccess.writeWait(tagId, writeAccessParams, null);
The application can call method reader.Actions.TagAccess.lockWait to perform lock operation on one or more memory banks with specific privileges.
// Lock the tag
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.LockAccessParams lockAccessParams = tagAccess.new LockAccessParams();
/* lock now */
lockAccessParams.setLockPrivilege(LOCK_DATA_FIELD.LOCK_USER_MEMORY, LOCK_PRIVILEGE.LOCK_PRIVILEGE_READ_WRITE);
lockAccessParams.setAccessPassword(0);
reader.Actions.TagAccess.lockWait(tagId, lockAccessParams, null);
The application can call method reader.Actions.TagAccess.killWait to kill a tag.
// Kill the tag
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.KillAccessParams killAccessParams = tagAccess.new KillAccessParams();
killAccessParams.setKillPassword(0);
reader.Actions.TagAccess.killWait(tagId, killAccessParams, null);
The application can call RFID_BlockErase to erase the contents of a tag.
// Block Erase
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.BlockEraseAccessParams blockEraseAccessParams = tagAccess.new BlockEraseAccessParams();
blockEraseAccessParams.setAccessPassword(0);
blockEraseAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER); // user memory bank
blockEraseAccessParams.setByteOffset(0); // start erasing from offset 0
blockEraseAccessParams.setByteCount(16); // number of bytes to erase
reader.Actions.TagAccess.blockEraseWait(tagId, blockEraseAccessParams, null);
The application can call method Reader.Actions.TagAccess.blockPermalockWait to block permalock a tag. Tags reported as part of Block-Permalock access operation will have TagData.getOpCode as ACCESS_OPERATION_BLOCK_PERMALOCK, and TagData.getOpStatus indicating the result of the operation. If TagData.OpStatus is ACCESS_SUCCESS, TagData.getMemoryBankData will contain the Block-Permalock Mask Data.
// Block-Perma Lock the tag
String tagId = "1234ABCD00000000000025B1";
TagAccess tagAccess = new TagAccess();
TagAccess.BlockPermalockAccessParams blockPermalockAccessParams = tagAccess.new BlockPermalockAccessParams();
byte[] permalockMask = new byte[] {(byte)0xF0, 0x00};
blockPermalockAccessParams.setReadLock(true);
blockPermalockAccessParams.setMemoryBank(MEMORY_BANK.MEMORY_BANK_USER);
blockPermalockAccessParams.setByteOffset(0);
blockPermalockAccessParams.setByteCount(1);
blockPermalockAccessParams.setMask(permalockMask);
blockPermalockAccessParams.setMaskLength(2);
reader.Actions.TagAccess.blockPermalockWait(tagId, blockPermalockAccessParams, null);